-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: Token fixes and improvements #1618
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
867c163
to
0095d36
Compare
Token `name` was misused: Sometimes it was assumed to be a symbol and sometimes an ID. It has therefore been replaced by `id` and `symbol` in all relevant places. Configuration files have been converted to use the token instance ID's from the context-addresses package to avoid ambiguity among (1) different tokens with the same symbol and (2) multiple token instances such as `USDC` (Circle issued) and `USDC.e` (bridged from Ethereum).
`Mangrove.getNameFromAddress` has been removed: It was ambiguous (multiple names could be registered) and only used for resolving tokens which can now be done with the new `configuration.tokens.getTokenIdFromAddress()` function.
5f806d9
to
16a7de6
Compare
ed20405
to
99f3a08
Compare
458febc
to
393e906
Compare
lnist
reviewed
Nov 27, 2023
# Conflicts: # CHANGELOG.md
lnist
approved these changes
Nov 27, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The token
name
was misused: Sometimes it was assumed to be a symbol and sometimes an ID. This caused issues now that we use token IDs that are different from the symbols. (also, thename
had nothing to do with the ERC20 name..)Token
name
has therefore been replaced byid
andsymbol
in all relevant places. Configuration files have been converted to use the token instance ID's from the context-addresses package to avoid ambiguity among (1) different tokens with the same symbol and (2) multiple token instances such asUSDC
(Circle issued) andUSDC.e
(bridged from Ethereum).Default token IDs can be registered for a symbol and network. And if there is only one ID for a given symbol on a network, it will be considered the default.
Mangrove.token()
will create an instance of the default token ID if found.In addition, the following changes have been made:
MgvToken
has been renamed toToken
. The prefix was at best confusing.Mangrove.openMarkets
function now returnsToken
s instead of a bespoke token data struct.Mangrove.market
andMarket.connect
now accept either symbol, token ID, orToken
for base and quote.{Mangrove, Token}.getTokenAddress(symbolOrId)
function has been added.displayName
anddisplayedAsPriceDecimals
toToken
.moize
package..Token.getDecimals
if decimals are not on record.Some unnecessary/redundant code/features have been removed as it simplified the task and made the code shorter and clearer:
configuration.tokens.fetchDecimalsFromAddress
. Instead, useToken.createTokenFromAddress
and read the decimals from that token.Mangrove.getTokenAndAddress
. Instead, useMangrove.tokenFromAddress
and read the address from there.Mangrove.tokenFromConfig
. UseMangrove.token
instead.Mangrove.getNameFromAddress
: It was ambiguous (multiple names could be registered) and only used for resolving tokens which can now be done with the newconfiguration.tokens.getTokenIdFromAddress()
function.Mangrove
andToken
. Instead, use the methods onconfiguration.tokens
.Mangrove.toUnits|fromUnits
no longer accepts a token name/symbol as this was ambiguous. Instead, useToken.createToken
and calltoUnits|fromUnits
on that.